<?php 
    if ($cart == null)
	{
		//防止购物车中没有数据
		$cart = array();
		echo "Cart is empty.";
	}
?>
<table id="checkout_cart_table">
	<colgroup>
    	<col />
        <col id="col_food_name"/>
        <col />
        <col />
        <col />
    </colgroup>
    <thead>
        <tr>
            <td class="th_food_image">商品图片</td>
            <td class="th_food_name" scope="col">商品名称</td>
            <td class="th_food_count">数量</td>
            <td class="th_food_price">单价</td>
            <td class="th_food_operate">操作</td>
        </tr>
    </thead>
    <tbody>
    <?php foreach ($cart as $restaurantID => $oneRestaurantCart) :?>
    	<?php foreach ($oneRestaurantCart['foodArray'] as $foodIndex => $oneFoodCart) : ?>
         <tr>
         	<td style="text-align: left;">
         	<?php if($oneFoodCart['hasPicture'] == 1):?>
            <img class="cart_img" src="<?php echo $oneFoodCart['picture'] ?>"/>
            <?php else:?>
            <span>暂无图片</span>
            <?php endif;?>
            </td>
            <td  style="text-align: left;"><a><?php echo $oneFoodCart['name'] ?></a></td>
            <td>
	            <span class="remove_product" onclick="substractFood('<?php echo $oneFoodCart['foodID'] ?>',1)"></span>
	            <span class="product_count_span"><?php echo $oneFoodCart['quantity'] ?> 份</span>
	            <span class="add_product" onclick="addFood('<?php echo $oneFoodCart['foodID'] ?>',1)"></span>
            </td>
            <td>
            <span class="product_price"><?php echo $oneFoodCart['price'] ?></span>元
            <input type="hidden" value="<?php echo $oneFoodCart['price']/$oneFoodCart['quantity'] ?>" name="one_food_price" />
            </td>            
            <td><a class="delete_product" onclick="removeFood('<?php echo $oneFoodCart['foodID'] ?>')">删除</a></td>
            <td>
	            <div class="foot_id_div">
	        		<input type=hidden name="foodCartArray[<?php echo $oneFoodCart['foodID'];?>][foodID]" value="<?php echo $oneFoodCart['foodID']?>">			
				</div>
				<div class="food_quantity_div">
					<input type=hidden name="foodCartArray[<?php echo $oneFoodCart['foodID'];?>][quantity]" value="<?php echo $oneFoodCart['quantity']?>">
	            </div>
            </td>
        </tr>
		<?php endforeach; ?>
		<?php $totalPrice = $oneRestaurantCart['restaurantTotalPrice'] ?>
		<?php break;?>
	<?php endforeach; ?>
    </tbody>
	<tfoot>
      	<tr>
         <td colspan="5"  id="total_price">商品总金额：
         <i><?php echo isset($totalPrice)?$totalPrice:0; ?>元</i>
         </td>
     	</tr>
	</tfoot>
</table>
<div id = "check_out_cart_ajax_loading_div">
		<img alt="Indicator" src="/images/common/ajax-loading.gif">
</div>
